import { AttributeTextType } from "../../scene/player/type/AttributeTextType";
import { AttributeText } from "../../scene/player/AttributeText";
import { AttributeValue } from "../../scene/player/AttributeValue";
import { LayerManager } from "../../manager/LayerManager";
import { TweenMax } from "../../../../com/greensock/TweenMax";
import { Circ } from "../../../../com/greensock/easing/Circ";
type int = number;
//class AttriAddEffect
    
    export  class AttriAddEffect
    {
        

        public static attriAdd(arg1: int, arg2: number, arg3: number, arg4: Boolean=false): void
        {
            var attriValue: int;
            var x: number;
            var y: number;
            var isCrit: Boolean=false;
            var attributeTextType: AttributeTextType;
            var attributeText: AttributeText;
            var endX: number;
            var endY: number;
            var tweenComplete: Function;

            var loc1;
            attributeTextType = null;
            attributeText = null;
            tweenComplete = null;
            attriValue = arg1;
            x = arg2;
            y = arg3;
            isCrit = arg4;
            tweenComplete = (): void
            {
                if (attributeText) 
                {
                    attributeText.parent.removeChild(attributeText);
                }
                return;
            }
            if (isCrit) 
            {
                attributeTextType = AttributeTextType.crit;
            }
            else 
            {
                attributeTextType = new AttributeTextType("");
            }
            attributeText = new AttributeText(new AttributeValue(attributeTextType, true, attriValue));
            if (isCrit) 
            {
                attributeText.textColor = 16711935;
            }
            attributeText.width = 200;
            attributeText.scaleX = 0.5;
            attributeText.scaleY = 0.5;
            attributeText.x = x - 0.5 * 0.5 * attributeText.textWidth;
            attributeText.y = y + 30;
            LayerManager.msgTipLayer.addChild(attributeText);
            endX = x - 0.5 * attributeText.textWidth;
            endY = y - 100;
            TweenMax.to(attributeText, 1, {"x": endX, "y": endY, "scaleX": 1, "scaleY": 1, "ease": Circ.easeOut, "onComplete": tweenComplete});
            return;
        }
    }
